# 定义要安装的功能
$feature = "RDC"

# 安装远程差异压缩 (RDC) 功能
$result = Install-WindowsFeature -Name $feature -IncludeManagementTools

# 检查安装结果
if ($result.Success) {
    Write-Host "远程差异压缩 (RDC) 功能已成功安装。" -ForegroundColor Green
    
    # 检查是否需要重启
    if ($result.RestartNeeded -eq "Yes") {
        Write-Host "警告：需要重启服务器以完成安装。" -ForegroundColor Yellow
    }
} else {
    Write-Host "安装远程差异压缩 (RDC) 功能时出现错误。" -ForegroundColor Red
}

# 显示已安装功能的详细信息
Write-Host "`n已安装的功能详情：" -ForegroundColor Cyan
Get-WindowsFeature | Where-Object {$_.Name -eq $feature} | Format-Table Name, DisplayName, InstallState